package com.sport.user.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sport.model.user.dtos.AccountUserDto;
import com.sport.model.user.pojos.AccountUser;
import com.sport.user.mapper.AccountMapper;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@NoArgsConstructor
public class UserRepository extends ServiceImpl<AccountMapper, AccountUser> {

    private AccountMapper accountMapper;

    private UserRepository(@Autowired AccountMapper accountMapper) {
        this.accountMapper = accountMapper;
    }

    public AccountUser getAccount(AccountUserDto accountUserDto){
        return getOne(Wrappers.<AccountUser>lambdaQuery()
                .eq(AccountUser::getSchoolAccount, accountUserDto.getSchoolAccount()));
    }

}
